home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
nvlexp
/
map_drv.frm
< prev
next >
Wrap
Text File
|
1995-12-05
|
4KB
|
142 lines
VERSION 2.00
Begin Form Map_Drv
Caption = "Map Drives"
ClientHeight = 4335
ClientLeft = 105
ClientTop = 390
ClientWidth = 8235
Height = 4740
Left = 45
LinkMode = 1 'Source
LinkTopic = "Form1"
ScaleHeight = 4335
ScaleWidth = 8235
Top = 45
Width = 8355
Begin TextBox Hidden2
Height = 285
Left = 6960
TabIndex = 4
Text = "Hidden2"
Top = 3750
Visible = 0 'False
Width = 885
End
Begin CommandButton Command2
Caption = "Quit"
Height = 495
Left = 3300
TabIndex = 2
Top = 3690
Width = 915
End
Begin CommandButton Command1
Caption = "Map Un-mapped Drive"
Height = 495
Left = 270
TabIndex = 1
Top = 3690
Width = 2145
End
Begin TextBox Hidden1
Height = 285
Left = 6960
TabIndex = 3
Text = "Hidden1"
Top = 3480
Visible = 0 'False
Width = 885
End
Begin ListBox List1
FontBold = -1 'True
FontItalic = 0 'False
FontName = "Courier"
FontSize = 9.75
FontStrikethru = 0 'False
FontUnderline = 0 'False
Height = 2955
Left = 270
TabIndex = 0
Top = 480
Width = 7575
End
End
DefInt A-Z
Sub Command1_Click ()
' Map un-mapped drives
PathFrm.Show 1
If Abort% = False Then 'go ahead & do it
DLetter$ = Hidden1.Text
DPath$ = Hidden2.Text
CServer$ = MainForm.Text1.Text
MDrive DLetter$, DPath$, CServer$
ClearListBox List1
FillForm
End If
End Sub
Sub Command2_Click ()
Unload Map_Drv
End Sub
Sub FillForm ()
' ===================================================================
' Note: This sub depends upon having a global array called ArrayUnMap
' ===================================================================
ReDim ArrayLocal(26) As Integer
ReDim ArrayHandle(26) As Integer
ReDim ArrayConnect(26) As Integer
ReDim ArrayUnMap$(26) ' ArrayUnMap$() is Global
For i% = 0 To 25
Res% = GetDriveInformation(i%, ConnectionID%, DirectoryHandle%)
If Res% = 128 Then
ArrayLocal(i%) = True
Else
ArrayLocal(i%) = False
End If
ArrayHandle(i%) = DirectoryHandle%
ArrayConnect(i%) = ConnectionID%
Next i%
j% = 1
For i% = 0 To 25
Tmp0$ = Chr$(65 + i%) + ": "
If ArrayLocal(i%) = True Then
Tmp1$ = "Local Drive: "
Else
Tmp1$ = "Network Drive: "
End If
If ArrayConnect(i%) = 0 And ArrayLocal(i%) <> True Then
ArrayUnMap$(j%) = Tmp0$
j% = j% + 1
Tmp2$ = "-- no mapping --"
Tmp3$ = ""
ElseIf ArrayLocal(i%) = True Then
Tmp2$ = "N/A"
Tmp3$ = ""
Else
Tmp2$ = Space$(255)
Ret% = GetDirectoryPath(ArrayHandle(i%), Tmp2$)
FSN$ = Space$(48)
GetFileServerName ArrayConnect(i%), FSN$
Tmp3$ = AllTrim(FSN$) + ": "
End If
TmpStr$ = Tmp0$ + Tmp1$ + Space$(3) + Tmp3$ + Tmp2$
Map_Drv.List1.AddItem TmpStr$
Next i%
End Sub
Sub Form_Load ()
FillForm
End Sub